package com.winning.xffw.service.consumer;

import com.alibaba.fastjson.JSON;
import com.winning.xffw.service.entity.dto.BduKafkaMsg;
import com.winning.xffw.service.service.IBduKafkaMsgService;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.annotation.KafkaListener;

/**
 * @Author: shipengfei
 * @Description:
 * @Date: 2019-05-23 10:31
 */
@Slf4j
public class DataLoadConsumer {

    @Autowired
    private IBduKafkaMsgService bduKafkaMsgService;

    @KafkaListener(topics = {"topicspf"})
    public void listen(ConsumerRecord<?, ?> record) {
        log.info("kafka的key: " + record.key());
        log.info("kafka的value: " + record.value().toString());
//        BduKafkaMsg msg = JSON.parseObject(record.value().toString(), BduKafkaMsg.class);
//        bduKafkaMsgService.saveKafkaMsg(msg);
    }


}
